import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.Socket;

/**
 * @author 陈Ser
 * @ClassName client
 * @description: TODO
 * @Date 2021/10/11 23:42
 * @Version 1.0
 */
public class client {
    public static void main(String[] args) throws IOException {
//        Socket socket = new Socket(InetAddress.getLocalHost(), 3307);
//        InputStream inputStream = socket.getInputStream();
//        OutputStream outputStream = socket.getOutputStream();
//
//
//        outputStream.write("hello".getBytes(StandardCharsets.UTF_8), 0, "hello".length());
//        System.out.println("client over of out...");
//
//        byte byteList[] = new byte[1024];
//        inputStream.read(byteList, 0, byteList.length);
//        System.out.println("client get:" + byteList);
//
//
//        System.out.println("yes");
//        while (true) {
//        }

        todo();


    }

    public static void todo() throws IOException {
        Socket socket = new Socket(InetAddress.getLocalHost(), 3307);
        FileOutputStream fileOutputStream = new FileOutputStream(new File("a.png"));
        byte bytes[] = new byte[1024];

        InputStream inputStream = socket.getInputStream();
        for (; inputStream.read(bytes) > -1; ) {
            fileOutputStream.write(bytes);
        }

        System.out.println("client over");
    }


}
